-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added getCollectionSize method for mysql mariadb postgres and mongodb… #1
Conversation
It works for MySQL, MariaDB and Postgres (I tested it). I don't know about mongodb becuase I tried to use the UTOPIA\MONGO\CLIENT and it is just crashing the server. So I used the MongoDB\Client and made a function to get the size in bytes and it worked so I have implemented a similar thing for the utopia mongo client class. |
src/Database/Adapter/MariaDB.php
Outdated
throw new Exception("Invalid table name"); | ||
} | ||
|
||
return (int) $size; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure we need the casting? need to be tasted with big numbers..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed it to a string.
src/Database/Adapter/Postgres.php
Outdated
$name = $this->filter($name); | ||
|
||
$query = $this->getPDO()->prepare(" | ||
SELECT pg_size_pretty(pg_total_relation_size( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please double-check with pg_size_pretty() as we want data in bytes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed getCollectionSize for Postgres as it works but is giving erros in the tests.
Thanks for the review. I will work on it |
No description provided.